#include "widget.h"
#include "ui_widget.h"

#include <QDebug>
#include <QTimer>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    timer = new QTimer(this);
    connect(timer, &QTimer::timeout, this, [this](){
        int value = ui->progressBar->value();

        if(value >= 100)
        {
//            timer->stop();
//            return;
            ui->progressBar->setValue(0);
        }
        ui->progressBar->setValue(value + 1);

    });
//    timer->start(100);  // 每0.1s走1%
    timer->start(1);  // 每0.1s走10%

}

Widget::~Widget()
{
    delete ui;
}

void Widget::updateProgressBar()
{

}

